\name{EVindex}
\alias{EVindex}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
%%  ~~function to do ... ~~
}
\description{
%%  ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
EVindex(x, y = NULL, ...)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{x}{
%%     ~~Describe \code{x} here~~
}
  \item{y}{
%%     ~~Describe \code{y} here~~
}
  \item{\dots}{
%%     ~~Describe \code{\dots} here~~
}
}
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
%%  ~Describe the value returned
%%  If it is a LIST, use
%%  \item{comp1 }{Description of 'comp1'}
%%  \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, y = NULL, ...) 
{
    if (!(inherits(x, "data.frame") | inherits(x, "matrix"))) 
        stop("x is not a data.frame or a matrix")
    if (!is.null(y)) 
        if (!(inherits(y, "data.frame") | inherits(y, "matrix"))) 
            stop("y is not a data.frame or a matrix")
    x <- as.matrix(x)
    y <- as.matrix(y)
    if (!is.numeric(x)) 
        stop("x must contain  numeric values")
    if (!is.numeric(y)) 
        stop("y must contain  numeric values")
    if (any(x < 0)) 
        stop("non negative value expected in df")
    if (any(x < 0)) 
        stop("non negative value expected in df")
    x <- as.matrix(1 * (x > 0))
    y <- as.matrix(1 * (y > 0))
    f1 <- function(df) {
        a <- df \%*\% t(df)
        b <- df \%*\% (1 - t(df))
        c <- (1 - df) \%*\% t(df)
        d <- ncol(df) - a - b - c
        2 * a/(2 * a + b + c)
    }
    f2 <- function(df1, df2) {
        a <- df1 \%*\% t(df2)
        b <- df1 \%*\% (1 - t(df2))
        c <- (1 - df1) \%*\% t(df2)
        d <- (1 - df1) \%*\% (1 - t(df2))
        2 * a/(2 * a + b + c)
    }
    if (is.null(y)) {
        w <- f1(x)
        w <- as.data.frame(w)
        if (!is.null(rownames(x))) {
            rownames(w) <- rownames(x)
            colnames(w) <- rownames(x)
        }
    }
    else {
        w <- f2(x, y)
        w <- as.data.frame(w)
        if (!is.null(rownames(x))) 
            rownames(w) <- rownames(x)
        if (!is.null(rownames(y))) 
            colnames(w) <- rownames(y)
    }
    return(w)
  }
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
